package com.health.pay.config;

import com.github.wxpay.sdk.WXPay;
import com.github.wxpay.sdk.WXPayConstants;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PayConfiguration {

    //微信支付配置类
    @Bean
    @ConfigurationProperties(prefix = "wx.pay")
    public WxPayConfig payConfig(){
        return new WxPayConfig();
    }

    @Bean
    @ConfigurationProperties(prefix = "ali.pay")
    public AlipayConfig alipayConfig(){
        return new AlipayConfig();
    }



    @Bean
    public WXPay wxPay(WxPayConfig wxPayConfig){
        //定义签名方式
        return new WXPay(wxPayConfig, WXPayConstants.SignType.HMACSHA256);
    }

}